# 请在此输入您的代码
n, q = map(int, input().split())
nums = list(map(int, input().split()))
result = 0
for _ in range(q):
    l, r = map(int, input().split())
    if (r - l + 1) & 1 == 0:
        result -= (r - l + 1) >> 1
    else:
        result -= (r - l) >> 1
        result += r
print(sum(nums) + result)
